package com.example.lixi;

import android.content.Context;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.widget.Toast;

/**
 * @author jie
 * @date 2021/4/27 -10:56
 */
public class WebAppInterface {
    Context mContext;
    WebView view;

    /**
     * Instantiate the interface and set the context
     */
    WebAppInterface(Context c) {
        mContext = c;
    }

    WebAppInterface(Context c, WebView webView) {
        mContext = c;
        this.view = webView;
    }

    /**
     * Show a toast from the web page
     */
    @JavascriptInterface
    public void showToast(String toast) {
        Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
    }


}

